// 专门创建store 实例对象
import {
  action,
  observable
} from 'mobx-miniprogram'

export const store = observable({
  numa: 1,
  numb: 2,
  activeTabIndex: 0,
  // 计算属性 get 表示sum是只读的
  get sum() {
    return this.numa + this.numb
  },
  // 修改store方法
  changeNuma: action(function (value) {
    this.numa += value
  }),
  changeNumb: action(function (value) {
    this.numb += value
  }),
  changeIndex: action(function (value) {
    this.activeTabIndex = value
  })
})